Hệ thống quản lý phương tiện trong PHP

1 <?php
2      $connection= mysqli_connect(
'localhost','root','','vehicle management');
3     session_start();
4
5     $id= $_GET[
'id'];
6     
7
8     $msg=
"";
9
10     
if(isset($_POST['submit'])){
11         $username= $_POST[
'username'];
12         $total_km=$_POST[
'total_km'];
13         $oil_cost=$_POST[
'oil_cost'];
14         $extra_cost=$_POST[
'extra_cost'];
15         $total_cost=$_POST[
'total_cost'];
16         
17     }
18
19     $sql=
"INSERT INTO `tripcost`(`booking_id`,`username`, `total_km`, `oil_cost`, `extra_cost`, `total_cost`) VALUES ('$id','$username','$total_km','$oil_cost','$extra_cost','$total_cost')";
20
21     $result= mysqli_query($connection,$sql);
22
23     
if($result==true){
24         $msg=
"<script language='javascript'>
25                                        swal(
26                                             'Success!',
27                                             'Registration Completed!',
28                                             'success'
29                                             );
30                           </script>"
;
31             
32         }
33         
else{
34             die(
'unsuccessful' .mysqli_error($connection));
35         }
36     
37     
38 ?>
39
40
41 <<!DOCTYPE html>
42 <html lang=
"en">
43 <head>
44     <meta charset=
"UTF-8">
45     <title>Document</title>
46      <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
47     
48    
49      <link rel=
"stylesheet" href="sweetalert2/sweetalert2.css">
50     <script src=
"sweetalert2/sweetalert2.min.js"></script>
51     
52     <script src=
"https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
53 </head>
54 <body>
55     <?php echo $msg;
56     ?>
57     
58     <script>
59     
60         
var timer = setTimeout(function() {
61             window.location=
'bookinglist.php'
62         },
1000);
63     </script>
64 </body>
65 </html>


Gõ tìm kiếm nhanh...